Imports DotNetNuke.UI.Utilities

<ControlMethodClass("MyCompany.MyClass3")> _
Partial Class ClientAPI_CallBackMethodsUC2
    Inherits System.Web.UI.UserControl

    Private m_DateTimeFormat As String = "mm/DD/YYYY"

    Public Property DateTimeFormat() As String
        Get
            Return m_DateTimeFormat
        End Get
        Set(ByVal value As String)
            m_DateTimeFormat = value
        End Set
    End Property

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        Dim script As String = String.Format("var m_object = new MyCompany.customObject('{0}', '{1}');", btnGetTime.NamingContainer.ClientID & "_", Me.ID)
        ScriptManager.RegisterStartupScript(Me.Page, Me.GetType(), "customObjectInit" & Me.ID, script, True)
        MSAJAX.RegisterClientScript(Me.Page, "~/ClientAPI/CallBackMethodsUC2.ascx.js")

        'Important, in order to distinguish between same control on page, we need to use a unique identifier
        ClientAPI.RegisterControlMethods(Me, Me.ID)

    End Sub

    <ControlMethod()> _
    Public Function GetDateTime() As String
        Return Now.ToString(DateTimeFormat)
    End Function



End Class
